<%@page import="com.model.Student"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'StudentList.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<style type="text/css">
  td{border: 1px solid #20B2AA;}
  a{
  text-decoration: none;
  }
</style>
  </head>
  
  <body>
      <table  style="width:100% ;">
          <tr style="background-color: #2E8B57">
            <td style="color:#fff"><b>&nbsp;学生信息列表</b></td>
          </tr>
          <tr>
             <td style="height:40px">
                      &nbsp;姓名：<input type="text" name="keyWord" />
                 <input type="submit" value="查询" />
             </td>
          </tr>
       </table>
      
      
      <table  style="width:100% ;">
          <tr style="background-color: #2E8B57;color:#fff">
            <th>学号</th>
            <th>姓名</th>
            <th>性别</th>
            <th>年龄</th>
            <th>联系方式</th>
            <th>住址</th>
            <th>班级编号</th>
            <th>操作</th>
          </tr>
          <%
               List<Student> list = (List<Student>)request.getAttribute("stuList");
               for(int i=0;i<list.size();i++)
               {
                   Student stu = list.get(i);
                   
                   out.write("<tr>");
                   out.write("<td>"+stu.getStu_xh()+"</td>");
                   out.write("<td>"+stu.getStu_name()+"</td>");
                   out.write("<td>"+stu.getStu_sex()+"</td>");
                   out.write("<td>"+stu.getStu_age()+"</td>");
                   out.write("<td>"+stu.getStu_mobile()+"</td>");
                   out.write("<td>"+stu.getStu_address()+"</td>");
                   out.write("<td>"+stu.getClass_id()+"</td>");
                   out.write("<td> <a href='studentServlet?action=getOne&xh="+stu.getStu_xh()+"' >编辑</a>  | <a href='studentServlet?action=delete&xh="+stu.getStu_xh()+"' onclick=\"return confirm('确定删除学生["+stu.getStu_name()+"]吗？');\">删除</a> </td>");
                   out.write("</tr>");
               }
          
           %>
      </table>
  </body>
</html>
